package com.zc.center.service;

import com.zc.common.annotations.VerticleMapping;
import io.vertx.core.json.Json;
import io.vertx.core.json.JsonObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;

@VerticleMapping
@Service
public class RouterService {
    private Logger logger = LoggerFactory.getLogger(RouterService.class);
    /**
     * 获得所有路由服务
     * @return
     */
    @Transactional(readOnly = true)
    public JsonObject doGetServiceTest(JsonObject param) throws Exception{
        JsonObject result=new JsonObject();
        result.put("ob",new HashMap(){{put("key","serviceName");put("key1","serviceName1");put("key2","serviceName2");put("key3","serviceName3");put("key4","serviceName4");}});
        System.out.println("this is Cluster1 services,"+this.getClass().getName()+"'s doGetServiceTest method return bace!");
        return new JsonObject(Json.encode(result));
    }

    /**
     * 获得所有路由服务
     * @return
     */
    @Transactional(readOnly = true)
    public JsonObject doGetValueTest(JsonObject param) throws Exception{
        JsonObject result=new JsonObject();
        result.put("ob",new HashMap(){{put("key","val");put("key1","val1");put("key2","val2");put("key3","val3");put("key4","val4");}});
        System.out.println("this is Cluster1 services,"+this.getClass().getName()+"'s doGetValueTest method return bace!");
        return new JsonObject(Json.encode(result));
    }
}
